package com.huali.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;

public class Login01Dao {
    private static String url="jdbc:mysql://localhost:3306/mydb?serverTimezone=Asia/Shanghai";
    private static String user="root";
    private static String password="123456";
    private static Connection connection=null;
    private static PreparedStatement statement=null;
    private static ResultSet resultSet=null;
    private static void init(){
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
           connection = DriverManager.getConnection(url, user, password);
        }catch(ClassNotFoundException | SQLException e){
            e.printStackTrace();
        }
    }

private static User executeSql(String name){
        init();
        User user=null;
        try {
            String sql="select username,password from user where username=?";
            statement=connection.prepareStatement(sql);
            resultSet=statement.executeQuery();
            while (resultSet.next()){
                user=new User();
                String username=resultSet.getString("");

            }
        }
}



}
